Micron Document
🎖️GitЯра🎖️

Node / meshtastic / Meshtastic-Android / files / core / network / src / commonTest / kotlin / org / meshtastic / core / network / transport / ConnectionFailuresTest.kt

Displaying Raw • Download

core/network/src/commonTest/kotlin/org/meshtastic/core/network/transport/ConnectionFailuresTest.kt 2d20cd8a4708e2ef66e98d5259f3a97ec93f240a (2d20cd8a) Text, 1.67 KB

T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.network.transport

Tff7b72import T7ee787kotlinx.io.IOException
Tff7b72import T7ee787kotlin.test.Test
Tff7b72import T7ee787kotlin.test.assertFalse
Tff7b72import T7ee787kotlin.test.assertTrue

Tff7b72class T56d364ConnectionFailuresTest Tb4b4b4{

Tf0883e@Test
Tff7b72fun Td2a8ff`an IO failure is an expected connection failure`Tb4b4b4(Tb4b4b4) Tb4b4b4{
Te6edf3assertTrueTb4b4b4(Te6edf3IOExceptionTb4b4b4(Ta5d6ff"Ta5d6ffConnection reset by peerTa5d6ff"Tb4b4b4)Tb4b4b4.Te6edf3isExpectedConnectionFailureTb4b4b4(Tb4b4b4)Tb4b4b4)
Tb4b4b4}

Tf0883e@Test
Tff7b72fun Td2a8ff`an IO subclass is an expected connection failure`Tb4b4b4(Tb4b4b4) Tb4b4b4{
Tff7b72class T56d364TruncatedReadTb4b4b4(Te6edf3messageTb4b4b4: Tffa657StringTb4b4b4) Tb4b4b4: Te6edf3IOExceptionTb4b4b4(Te6edf3messageTb4b4b4)

Te6edf3assertTrueTb4b4b4(Te6edf3TruncatedReadTb4b4b4(Ta5d6ff"Ta5d6ffNot enough data availableTa5d6ff"Tb4b4b4)Tb4b4b4.Te6edf3isExpectedConnectionFailureTb4b4b4(Tb4b4b4)Tb4b4b4)
Tb4b4b4}

Tf0883e@Test
Tff7b72fun Td2a8ff`a programming error is not an expected connection failure`Tb4b4b4(Tb4b4b4) Tb4b4b4{
Te6edf3assertFalseTb4b4b4(Te6edf3IllegalStateExceptionTb4b4b4(Ta5d6ff"Ta5d6ffUnexpected call to beginMessage()Ta5d6ff"Tb4b4b4)Tb4b4b4.Te6edf3isExpectedConnectionFailureTb4b4b4(Tb4b4b4)Tb4b4b4)
Te6edf3assertFalseTb4b4b4(Te6edf3IllegalArgumentExceptionTb4b4b4(Ta5d6ff"Ta5d6ffbad argumentTa5d6ff"Tb4b4b4)Tb4b4b4.Te6edf3isExpectedConnectionFailureTb4b4b4(Tb4b4b4)Tb4b4b4)
Te6edf3assertFalseTb4b4b4(Te6edf3NullPointerExceptionTb4b4b4(Tb4b4b4)Tb4b4b4.Te6edf3isExpectedConnectionFailureTb4b4b4(Tb4b4b4)Tb4b4b4)
Tb4b4b4}
Tb4b4b4}

Served by rngit 1.5.0 - Generated in 0.05s